﻿// Decompiled with JetBrains decompiler
// Type: 我的小工具.frmVersion
// Assembly: 开发辅助工具, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: F78E5980-5E94-4E46-ABDF-DC8C6CBF52AA
// Assembly location: K:\Tools\工具\开发辅助工具庆六一版\开发辅助工具2015-06-01\开发辅助工具.exe

using PetaPoco;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace 我的小工具
{
  public class frmVersion : Form
  {
    public string ParamKey = "";
    private sqlserverDB db = new sqlserverDB();
    private IContainer components = (IContainer) null;
    private Panel panel1;
    private Button button1;
    private TextBox textBox1;
    private Panel panel2;
    private ListView listView1;
    private ColumnHeader columnHeader1;
    private ColumnHeader columnHeader2;
    private ColumnHeader columnHeader3;
    private ColumnHeader columnHeader4;

    public frmVersion()
    {
      this.InitializeComponent();
    }

    private void frmVersion_Load(object sender, EventArgs e)
    {
      this.textBox1.Text = this.ParamKey;
      this.QueryVersion();
    }

    private void QueryVersion()
    {
      Sql sql = new Sql("Where 1=1", new object[0]);
      string text = this.textBox1.Text;
      if (string.IsNullOrEmpty(text))
        return;
      if (text.ToLower().StartsWith("erp"))
        sql.Append("AND VersionName like '%" + text + "%'", new object[0]);
      else
        sql.Append("AND VersionNum like '%" + text + "%'", new object[0]);
      sql.OrderBy((object) "VersionID");
      this.listView1.Items.Clear();
      foreach (dp_Version dpVersion in this.db.Query<dp_Version>(sql))
      {
        string[] items = new string[4]
        {
          dpVersion.System,
          dpVersion.VersionName,
          dpVersion.VersionNum,
          null
        };
        string[] strArray = items;
        int index = 3;
        DateTime? releaseDate = dpVersion.ReleaseDate;
        string str;
        if (releaseDate.HasValue)
        {
          releaseDate = dpVersion.ReleaseDate;
          str = releaseDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
        }
        else
          str = "";
        strArray[index] = str;
        this.listView1.Items.Add(new ListViewItem(items)
        {
          Tag = (object) dpVersion
        });
      }
    }

    private void button1_Click(object sender, EventArgs e)
    {
      this.QueryVersion();
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
      this.QueryVersion();
    }

    protected override void Dispose(bool disposing)
    {
      if (disposing && this.components != null)
        this.components.Dispose();
      base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
      this.panel1 = new Panel();
      this.button1 = new Button();
      this.textBox1 = new TextBox();
      this.panel2 = new Panel();
      this.listView1 = new ListView();
      this.columnHeader1 = new ColumnHeader();
      this.columnHeader2 = new ColumnHeader();
      this.columnHeader3 = new ColumnHeader();
      this.columnHeader4 = new ColumnHeader();
      this.panel1.SuspendLayout();
      this.panel2.SuspendLayout();
      this.SuspendLayout();
      this.panel1.Controls.Add((Control) this.button1);
      this.panel1.Controls.Add((Control) this.textBox1);
      this.panel1.Dock = DockStyle.Top;
      this.panel1.Location = new Point(0, 0);
      this.panel1.Name = "panel1";
      this.panel1.Size = new Size(345, 34);
      this.panel1.TabIndex = 0;
      this.button1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      this.button1.Location = new Point(287, 5);
      this.button1.Name = "button1";
      this.button1.Size = new Size(53, 23);
      this.button1.TabIndex = 1;
      this.button1.Text = "搜索";
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Click += new EventHandler(this.button1_Click);
      this.textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
      this.textBox1.Location = new Point(4, 7);
      this.textBox1.Name = "textBox1";
      this.textBox1.Size = new Size(279, 21);
      this.textBox1.TabIndex = 0;
      this.textBox1.TextChanged += new EventHandler(this.textBox1_TextChanged);
      this.panel2.Controls.Add((Control) this.listView1);
      this.panel2.Dock = DockStyle.Fill;
      this.panel2.Location = new Point(0, 34);
      this.panel2.Name = "panel2";
      this.panel2.Size = new Size(345, 301);
      this.panel2.TabIndex = 1;
      this.listView1.AllowColumnReorder = true;
      this.listView1.Columns.AddRange(new ColumnHeader[4]
      {
        this.columnHeader1,
        this.columnHeader2,
        this.columnHeader3,
        this.columnHeader4
      });
      this.listView1.Dock = DockStyle.Fill;
      this.listView1.FullRowSelect = true;
      this.listView1.GridLines = true;
      this.listView1.Location = new Point(0, 0);
      this.listView1.Name = "listView1";
      this.listView1.Size = new Size(345, 301);
      this.listView1.TabIndex = 0;
      this.listView1.UseCompatibleStateImageBehavior = false;
      this.listView1.View = View.Details;
      this.columnHeader1.Text = "系统";
      this.columnHeader1.Width = 90;
      this.columnHeader2.Text = "版本";
      this.columnHeader2.Width = 80;
      this.columnHeader3.Text = "版本号";
      this.columnHeader3.Width = 90;
      this.columnHeader4.Text = "发布日期";
      this.columnHeader4.Width = 80;
      this.AutoScaleDimensions = new SizeF(6f, 12f);
      this.AutoScaleMode = AutoScaleMode.Font;
      this.ClientSize = new Size(345, 335);
      this.Controls.Add((Control) this.panel2);
      this.Controls.Add((Control) this.panel1);
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = "frmVersion";
      this.ShowIcon = false;
      this.StartPosition = FormStartPosition.CenterParent;
      this.Text = "版本号查询";
      this.Load += new EventHandler(this.frmVersion_Load);
      this.panel1.ResumeLayout(false);
      this.panel1.PerformLayout();
      this.panel2.ResumeLayout(false);
      this.ResumeLayout(false);
    }
  }
}
